package edu.fiu.cis.selfhealingdisk;



/**
 * @author vanvorst
 *
 */
public class Event {
	public enum  EventType {
		TIME_WARP,
		IOREQUESTS,
		DONE
	};
	
	private final EventType type;
	private final IORequestList iorequests;
	private final Long timeleap;
	
	/**
	 * @return
	 */
	public static Event createWarpEvent(long time) {
		return new Event(EventType.TIME_WARP,null,time);
	}
	
	/**
	 * @return
	 */
	public static Event createDoneEvent() {
		return new Event(EventType.DONE, null,null);
	}
	
	public static Event createIOEvent(IORequestList r) {
		return new Event(EventType.IOREQUESTS, r,null);
	}
	
	/**
	 * @param type
	 */
	private Event(EventType type,IORequestList iorequest,Long leap) {
		this.type = type;
		this.iorequests=iorequest;
		this.timeleap = leap;
	}

	/**
	 * @return the type
	 */
	public final EventType getEventType() {
		return type;
	}
	
	/**
	 * @return the iorequest
	 */
	public final IORequestList getIORequests() {
		return this.iorequests;
	}
	
	/**
	 * 
	 * @return return the new simulation time. This parameter is changed in TIME_WARP events. 
	 */
	public final long getNewTime() {
		return this.timeleap;
	}
	
}
